import requests
from config import *


class ContractAPI:
    # 合同上传
    def upload_contract(self, token, file_path):
        """合同上传"""
        return requests.post(f"{base_url}/api/common/upload", headers={"Authorization": token},
                             files={"file": open(file_path, "rb")})

    # 新增合同
    def add_contract(self, token, add_contract_data):
        """新增合同"""
        return requests.post(f"{base_url}/api/contract", headers={"Authorization": token}, json=add_contract_data)

    # 查询合同列表
    def query_contract_list(self, token, params):
        """查询合同列表"""
        return requests.get(f"{base_url}/api/contract/list", headers={"Authorization": token}, params=params)
        pass
